/*
 * Person.java
 * Team qq 2011
 */
package com.google.code.timetrail.backend;

/**
 * @author Jake Gibel
 * @version $Revision: 1.0 $
 */
public class Person {

	/**
	 * health - the person's current health.
	 */
	/**
	 * death - the person's probability of death.
	 */
	/**
	 * illness - the person's probability of illness.
	 */
	protected int illness, death, health;

	/**
	 * name - the person's name.
	 */
	protected String name;
	
	/** Standard starting money except for Entrepreneurs and Nutritionists*/
	private static final int START_MONEY = 800; 

	/**
	 * Standard amount of starting fuel cells.
	 */
	private static final int START_FCELL = 0;

	/**
	 * standard amount of starting food.
	 */
	private static final int START_FOOD = 0;

	/**
	 * standard amount of starting hull parts.
	 */
	private static final int START_HULLP = 0;

	/**
	 * standard amount of starting fuel capacitors.
	 */
	private static final int START_FCAP = 0;

	/**
	 * standard amount of starting illness factors.
	 */
	private static final int START_ILL = 5;

	/**
	 * standard amount of starting death factor.
	 */
	private static final int START_DEATH = 5;

	/**
	 * standard amount of starting health.
	 */
	private static final int START_HEALTH = 95;
	
	/**
	 * instantiates the persons illness and death probability as well as their health.
	 */
	public Person() {
		illness = START_ILL;
		death = START_DEATH;
		health = START_HEALTH;
	}
	
	/**
	 * sets the person's name then instantiates the persons illness and death probability 
	 * as well as their health.
	 * @param name their name
	 */
	public Person(String name){
		this();
		this.name = name;
	}

	/**
	 * Adds an initial bonus to the inventory
	 * typically depending on what subclass of person 
	 * is recognized 
	 * @param inv the inventory that will receive the bonus
	 */
	public void initialBonus(Inventory inv){
		inv.addItem(START_MONEY, inv.getMoney());
		inv.addItem(START_FOOD, inv.getFood());
		inv.addItem(START_FCELL, inv.getFuelCells());
		inv.addItem(START_HULLP, inv.getHullParts());
		inv.addItem(START_FCAP, inv.getHullParts());
	}
	
	/**
	 * returns if the person is alive.
	
	 * @return true if health is above zero */
	public boolean isAlive() {
		return health > 0;
	}

	/**
	 * returns the illness factor.
	
	 * @return illness factor */
	public int getIllness() {
		return illness;
	}

	/**
	 * sets the player's illness factor.
	 * @param illness the illness factor that you want to set the players to.
	 */
	public void setIllness(int illness) {
		this.illness = illness;
	}

	/**
	 * returns the death factor.
	
	* @return  the player's death factorr*/
	public int getDeath() {
		return death;
	}

	/**
	 * set the player's death factor.
	 * @param death the death factor that you want to change it to
	 */
	public void setDeath(int death) {
		this.death = death;
	}

	/**
	 * returns the player's health.
	
	 * @return the player's health */
	public int getHealth() {
		return health;
	}

	/**
	 * Method setHealth.
	 * @param health int
	 */
	public void setHealth(int health) {
		this.health = health;
	}

	/**
	 * returns the player's name.
	
	 * @return the player's name */
	public String getName() {
		return name;
	}

	/**
	 * set the player's name.
	 * @param name the player's name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * returns the string representation of a Person.
	 * @return the string representation of a Person
	 */
	public String toString(){
        return name + " has health of " + this.health;
	    
	}
}
